MC-30: Sync Database-entity-details; drop the vendored pipeline-records schema - #14
Merged
touchdownllc merged 2 commits intoAug 3, 2026
Conversation
touchdownllc
marked this pull request as draft
July 24, 2026 17:45
Documents five changes that have landed on the pipeline side, so the entity and field tables describe what the pipeline now emits. Fact-run identity (nachos-ai-poc-3#345, ADR 0023). fact_runs gains observations_digest and fact_run_digest, plus a Fact-run identity section naming fact_run_digest as the dedup key. Nothing the landing side deduped on covered a fact-run header: correcting fact_run.mode from "api" to "llm" (MC-24 §8.8) changed 135 headers while every identity the loader compares stayed byte-identical, so the load decided the run was already there and skipped the correction. base_nachos_score on score_records. adjusted_nachos_score was already a column; the base methodology tier it is built from was reachable only inside the open dimensions blob, so one half of the base/adjusted pair needed a JSON dig. Landing-derived from dimensions.nachos_score.value, the same way documentation_gap is, so nothing changes on the emit side. source_document_description and school_year on source_elements (nachos-ai-poc-3#351, ADR 0016) — operator-supplied provenance for the documentation package an artifact was built from, sourced from the pipeline's committed data/source_documents.yaml registry. Display-only, never scored. documented on score_records (nachos-ai-poc-3#364, ADR 0025) — the headline predicate aggregate computes every reported mean, dimension distribution, and review count over. documentation_source cannot stand in for it: on the API- model lens every row is source_doc. Sidecar contract version 3 -> 4, which per ADR 0017 does not stale adjudications. prompt_fingerprint and answered_by_host on fact_runs (nachos-ai-poc-3#378 and #381, ADR 0027; host tags #392, refined by #394); fact identity version 1 -> 2 as an epoch marker, both fields nullable and covered by the ADR 0023 deny-list so the digest recipe is unchanged. Also corrects the fact_runs.contract_version row, which described the sidecar meaning — the exact touchdownllc/dataload_poc#27 conflation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs/design/schemas/pipeline-records.schema.json was a second copy of an artifact the pipeline generates and owns (publish/pipeline_records_contract.py), kept byte-identical by hand because the generator and the consumer of the contract lived in separate repos. The POC-3 migration brings the generator into this repo, so the copy stops being a sync target — it would be a stale sibling of a file generated a directory away. Delete it and let the migration land the one copy. Database-entity-details pointed at it by repo path in five places. Those now name the companion schema without pinning a path, since the migration settles where it lands, and the two-repo byte-identity discipline goes with the copy. MC-18 still validates emitted records against the schema; what it no longer has is a second copy to enforce identity against. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
touchdownllc
force-pushed
the
MC-30-fact-run-identity-schema-sync
branch
from
July 28, 2026 00:46
5be1113 to
8e6b020
Compare
touchdownllc
marked this pull request as ready for review
July 31, 2026 22:45
CSR2017
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
MC-30 is now scoped to the documentation side only. This PR does two things:
docs/design/Database-entity-details.mdto match five changes thathave landed on the pipeline side, so the entity and field tables describe
what the pipeline actually emits.
docs/design/schemas/pipeline-records.schema.json. The schemaarrives with the POC-3 migration ([MC-1] NACHOS automated scoring engine - initial code migration #11), which brings in the generator that
produces it.
One commit each.
1. The doc sync
Fact-run identity —
fact_runsgains the dedup keyA fact-run header carries
mode,model,prompt_version,status,cost_cap_hitand the run counts. Nothing the landing side deduped on coveredany of it:
ingestion_runs.run_idcomes purely from the ingestion inputs, andthe per-(state, lens)
release_idcovers scored records.That gap was observed, not theorised. Correcting
fact_run.modefrom"api"to"llm"(MC-24 §8.8) changed 135 fact-run headers while every identity the loadercompares stayed byte-identical. The load concluded the run was already landed and
skipped the correction.
Two digest columns close it (nachos-ai-poc-3#345, ADR 0023):
observations_digest— sha256 over the observation rows. What was extracted.fact_run_digest— sha256 over the identity-recipe version, everynon-volatile header field, and
observations_digest. The dedup key. Equalmeans the held row is current, skip. Different means re-land, including when
ingestion_run_idand the snapshot digests are unchanged — the case thatbroke. Comparing the pair separates a header-only correction (observations
equal, run digest moved) from changed data (both moved).
The digest does not cover
scored_ator the token/cost/cache counters: thosedescribe the occurrence, and a cache-warm replay of identical facts reports
$0and different token counts without being new data.
Adds a Fact-run identity section plus the two
fact_runsrows.base_nachos_scoreonscore_recordsadjusted_nachos_scorewas already a column; the base methodology tier it isbuilt from (0–3) was reachable only inside the open
dimensionsblob(
dimensions.nachos_score.value), so one half of the base/adjusted headline wasa plain column and the other needed a JSON dig.
Landing-derived from
dimensions.nachos_score.valuethe same waydocumentation_gapis, so nothing changes on the emit side.Distinct from
complexity_score:nachos_scoreis the NACHOS methodology tierthat feeds
adjusted_nachos_score;complexity_scoreis thebusiness_logic_complexitycomprehension-cost signal. Same input facts,different rubric — they coincide on ~99% of rows but diverge where the
methodology rules differ: 238 / 24,990 rows in release
r-37334d4a830f060d.source_document_descriptionandschool_yearonsource_elementsOperator-supplied provenance for the documentation package an artifact was built
from — a plain-English label like "TEA publication Jan 2026" and, optionally, the
school year it targets — sourced from the pipeline's committed
data/source_documents.yamlregistry. Both are uniform across every record of oneartifact; display-only, never scored.
source_document_descriptionis requirednon-blank,
school_yearis required-but-nullable.nachos-ai-poc-3#351 (ADR 0016).
documentedonscore_records; sidecar contract 3 → 4documentedis the headline predicate. Aggregate computes every reported mean,dimension distribution and review count over the rows where it is true (the
header's
in_scope_countis their count), but no per-record field let a consumerreproduce that population from a sidecar alone.
documentation_sourcelooks likeit should serve and does not: on the API-model lens every row is
source_doc, soa consumer keying on it computes the headline population correctly on one lens and
silently wrongly on the other.
Per ADR 0017 the contract-version bump does not stale adjudications.
nachos-ai-poc-3#364 (ADR 0025).
prompt_fingerprintandanswered_by_hostonfact_runs; fact identity 1 → 2prompt_fingerprint— sha256 over the rendered prompt batches that produced theobservations; the producer's own freshness key, which freshness previously could
not detect a change to.
answered_by_host— which endpoint served the run (anthropic,azure:<host>/<deployment>,deterministic, thecache:/mixed:replay tags,or
unknown). Records whatmodelcannot: an Azure-hosted run still reportsthe base model id.
Both are nullable and covered by the ADR 0023 deny-list by construction, so the
digest recipe is unchanged; the fact-identity version moves 1 → 2 purely as an
epoch marker. One-time consequence: every
fact_run_digestin the tree changes atonce while every
observations_digeststays put, so a loader re-lands each factrun once rather than reading independent content changes.
This also corrects the
fact_runs.contract_versionrow, which described thesidecar meaning — the exact touchdownllc/dataload_poc#27 conflation. A fact run has
no sidecar; its
contract_versionis the fact-identity recipe epoch.nachos-ai-poc-3#378/#381 (ADR 0027); host tags #392, refined by #394.
2. Deleting the vendored schema
docs/design/schemas/pipeline-records.schema.jsonwas a second copy of an artifactthe pipeline generates and owns (
publish/pipeline_records_contract.py), keptbyte-identical by hand because the generator and the consumer of the contract lived
in separate repos. The POC-3 migration brings the generator into this repo, so the
copy stops being a sync target — it would be a stale sibling of a file generated a
directory away.
Database-entity-details.mdpointed at it by repo path in five places. Those nowname the companion schema without pinning a path, since the migration settles where
it lands, and the two-repo byte-identity discipline goes with the copy.
MC-18 is unaffected in substance. The contract test still validates
pipeline-emitted records against the schema on every build; what it no longer has is
a second copy to enforce byte identity against. That is a simplification of MC-18,
not a gap — it should be picked up when the migration lands and the schema's path in
this repo is known.
Files
docs/design/Database-entity-details.md— the five changes above, plus thepath-free rewording of the five schema references.
docs/design/schemas/pipeline-records.schema.json— deleted.